import type { Adminer, Permission, AdminerState } from '@/types/pinia'

export const useAdminerStore = defineStore('adminer', {
	state: (): AdminerState => ({
		adminer: {} as Adminer,
		permissions: [] as Permission[]
	}),
	getters: {
		getAdminer: state => state.adminer,
		getPermissions: state => state.permissions
	},
	actions: {
		updateAdminer(newAdminer: Partial<Adminer> = {}) {
			this.adminer = { ...this.adminer, ...newAdminer }
		},
		updatePermissions(newPermissions: Permission[] = []) {
			this.permissions = newPermissions
		}
	}
})
